home *** CD-ROM | disk | FTP | other *** search
/ Disc to the Future 2 / Disc to the Future Part II Programmer's Reference (Wayzata Technology)(6013)(1992).bin / MAC / THINKC / 5 / MACVOGL- / MOVE.C < prev    next >
C/C++ Source or Header  |  1992-07-19  |  3KB  |  208 lines

  1. #include "vogl.h"
  2.  
  3. /*
  4.  * move
  5.  *
  6.  * Move the logical graphics position to the world coordinates x, y, z.
  7.  *
  8.  */
  9. void
  10. move(x, y, z)
  11.     Coord     x, y, z;
  12. {
  13.     Token    *p;
  14.  
  15.     if (!vdevice.initialised) 
  16.         verror("move: vogl not initialised");
  17.  
  18.     vdevice.cpW[V_X] = x;
  19.     vdevice.cpW[V_Y] = y;
  20.     vdevice.cpW[V_Z] = z;
  21.  
  22.     vdevice.cpVvalid = 0;
  23.  
  24.     if (vdevice.inobject) {
  25.         p = newtokens(4);
  26.  
  27.         p[0].i = MOVE;
  28.         p[1].f = x;
  29.         p[2].f = y;
  30.         p[3].f = z;
  31.  
  32.         return;
  33.     }
  34.  
  35.     if (vdevice.clipoff) {        /* update device coords as well */
  36.         multvector(vdevice.cpWtrans, vdevice.cpW, vdevice.transmat->m);
  37.         vdevice.cpVx = WtoVx(vdevice.cpWtrans);
  38.         vdevice.cpVy = WtoVy(vdevice.cpWtrans);
  39.     }
  40. }
  41.  
  42. /*
  43.  * moves
  44.  *
  45.  * Move the logical graphics position to the world coordinates x, y, z.
  46.  * expressed as a short integer data type.
  47.  *
  48.  */
  49. void
  50. moves(x, y, z)
  51.     Scoord     x, y, z;
  52. {
  53.     move((Coord)x, (Coord)y, (Coord)z);
  54. }
  55.  
  56.  
  57. /*
  58.  * movei
  59.  *
  60.  * Move the logical graphics position to the world coordinates x, y, z.
  61.  * expressed as an integer data type.
  62.  *
  63.  */
  64. void
  65. movei(x, y, z)
  66.     Icoord     x, y, z;
  67. {
  68.     move((Coord)x, (Coord)y, (Coord)z);
  69. }
  70.  
  71.  
  72. /*
  73.  * move2
  74.  *
  75.  * Move the logical graphics position to the world coords x, y, 0.0
  76.  * (I.e. a 2D move is defined as a 3D move with the Z-coord set to zero)
  77.  *
  78.  */
  79. void
  80. move2(x, y)
  81.     Coord    x, y;
  82. {
  83.     if (!vdevice.initialised) 
  84.         verror("move2: vogl not initialised");
  85.  
  86.     move(x, y, 0.0);
  87. }
  88.  
  89. /*
  90.  * move2s
  91.  *
  92.  * Move the logical graphics position to the world coordinates x, y.
  93.  * expressed as a short integer data type.
  94.  *
  95.  */
  96. void
  97. move2s(x, y)
  98.     Scoord     x, y;
  99. {
  100.     move2((Coord)x, (Coord)y);
  101. }
  102.  
  103.  
  104. /*
  105.  * move2i
  106.  *
  107.  * Move the logical graphics position to the world coordinates x, y.
  108.  * expressed as an integer data type.
  109.  *
  110.  */
  111. void
  112. move2i(x, y)
  113.     Icoord     x, y;
  114. {
  115.     move2((Coord)x, (Coord)y);
  116. }
  117.  
  118.  
  119. /*
  120.  * rmv
  121.  *
  122.  * move the logical graphics position from the current world 
  123.  * coordinates by dx, dy, dz 
  124.  *
  125.  */
  126. void
  127. rmv(dx, dy, dz)
  128.     Coord    dx, dy, dz;
  129. {
  130.     if (!vdevice.initialised) 
  131.         verror("rmv: vogl not initialised");
  132.  
  133.     move((vdevice.cpW[V_X] + dx), (vdevice.cpW[V_Y] + dy), (vdevice.cpW[V_Z] + dz));
  134. }
  135.  
  136. /*
  137.  * rmvs
  138.  *
  139.  * move the logical graphics position from the current world 
  140.  * coordinates by dx, dy, dz expressed as a short integer data type.
  141.  *
  142.  */
  143. void
  144. rmvs(dx, dy, dz)
  145.     Scoord    dx, dy, dz;
  146. {
  147.     rmv((Coord)dx, (Coord)dy, (Coord)dz);
  148. }
  149.  
  150. /*
  151.  * rmvi
  152.  *
  153.  * move the logical graphics position from the current world 
  154.  * coordinates by dx, dy, dz expressed as an integer data type.
  155.  *
  156.  */
  157. void
  158. rmvi(dx, dy, dz)
  159.     Icoord    dx, dy, dz;
  160. {
  161.     rmv((Coord)dx, (Coord)dy, (Coord)dz);
  162. }
  163.  
  164. /*
  165.  * rmv2
  166.  *
  167.  * Move Relative in 2D.
  168.  *
  169.  */
  170. void
  171. rmv2(dx, dy)
  172.     double    dx, dy;
  173. {
  174.     if (!vdevice.initialised) 
  175.         verror("rmv2: vogl not initialised");
  176.  
  177.     move((vdevice.cpW[V_X] + dx), (vdevice.cpW[V_Y] + dy), 0.0);
  178. }
  179.  
  180. /*
  181.  * rmv2s
  182.  *
  183.  * move the logical graphics position from the current world 
  184.  * coordinates by dx, dy expressed as a short integer data type.
  185.  *
  186.  */
  187. void
  188. rmv2s(dx, dy)
  189.     Scoord    dx, dy;
  190. {
  191.     rmv2((Coord)dx, (Coord)dy);
  192. }
  193.  
  194. /*
  195.  * rmv2i
  196.  *
  197.  * move the logical graphics position from the current world 
  198.  * coordinates by dx, dy expressed as an integer data type.
  199.  *
  200.  */
  201. void
  202. rmv2i(dx, dy)
  203.     Icoord    dx, dy;
  204. {
  205.     rmv2((Coord)dx, (Coord)dy);
  206. }
  207.  
  208.